import request from '@/utils/request'

export function add(data) {
  return request({
    url: '/sys/user/save',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: '/sys/user/delete',
    method: 'post',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: '/sys/user/update',
    method: 'post',
    data
  })
}

export function editUser(data) {
  return request({
    url: 'sys/user/update',
    method: 'post',
    data
  })
}

export function updatePass(user) {
  const data = {
    password: user.password,
    newPassword: user.newPassword
  }
  return request({
    url: 'sys/user/password',
    method: 'post',
    data
  })
}

export function get(data) {
  return request({
    url: `/sys/user/info/${data}`,
    method: 'get'
  })
}

export default { add, edit, del, get }

